﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
using Common;
using Models;

namespace CSMF
{
    public class HomeCommentModel
    {
        public PageInfo PageInfo { get; set; }
        public int ObjId { get; set; }
        public int ObjTypeId { get; set; }

        public PagedList<CommentInfo> CommentInfos { get; set; }
    }


    public partial class VipHomeComment : System.Web.UI.UserControl
    {
        public string SinaRedirectUrl;
        private CommentService _commentService = new CommentService();
        public HomeCommentModel postCommentModel = null;



        protected void Page_Load(object sender, EventArgs e)
        {
            var pageSize = int.Parse(ConfigurationManager.AppSettings["CommentPageSize"]);
            postCommentModel = new HomeCommentModel();
            postCommentModel.CommentInfos = _commentService.GetVipCommentsByObjId( 0,
                                                                               pageSize);

            var pageInfo = new PageInfo()
                               {
                                   PageIndex = postCommentModel.CommentInfos.PageIndex,
                                   PageSize = postCommentModel.CommentInfos.PageSize,
                                   TotalCount = postCommentModel.CommentInfos.TotalCount,
                                   TotalPages = postCommentModel.CommentInfos.TotalPages,
                                   HasPreviousPage = postCommentModel.CommentInfos.HasPreviousPage,
                                   HasNextPage = postCommentModel.CommentInfos.HasNextPage,
                               };

            postCommentModel.PageInfo = pageInfo;
         

        }
    }
}